/* 移动端个人中心样式 */

.page-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding-top: 0;
    padding-bottom: 100px; /* 增加底部空间 */
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 按钮图标 */
.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
}

/* 用户信息卡片 */
.user-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-radius: 0 0 24px 24px;
    padding: 32px 24px 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.user-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    margin: 0 auto 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* 头像上传区域 */
.avatar-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 12px;
    background: #f8f9fa;
    margin-bottom: 12px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    object-fit: cover;
}

.avatar-preview-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.file-hint {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.error-message {
    color: #ff4757;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

.user-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.user-email {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* 统计网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* 区块 */
.section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    padding-left: 4px;
}

.section-desc {
    font-size: 14px;
    color: white;
    margin-bottom: 16px;
    padding-left: 4px;
    opacity: 0.9;
}

/* 答题历史 */
.quiz-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-score {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.history-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.detail-item-inline {
    text-align: center;
    font-size: 12px;
}

.detail-item-inline .detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.detail-item-inline .detail-label {
    color: var(--text-secondary);
}

.detail-item-inline.correct .detail-value {
    color: var(--success-color);
}

.detail-item-inline.wrong .detail-value {
    color: var(--danger-color);
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 8px;
}

/* 退出登录区域 */
.logout-section {
    margin-top: 32px;
    margin-bottom: 20px; /* 确保底部有足够空间 */
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* 模态框 */
.modal {
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

/* 详情模态框 */
.detail-modal {
    width: 100%;
    max-width: 95vw;
    max-height: 90vh;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
}

.modal-body {
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* 详情内容样式 */
.detail-overview {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}

.detail-stat {
    display: flex;
    flex-direction: column;
}

.detail-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.detail-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.questions-detail-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-detail-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 2px solid var(--border-color);
}

.question-detail-item.correct {
    border-color: var(--success-color);
}

.question-detail-item.wrong {
    border-color: var(--danger-color);
}

.question-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.question-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.question-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.question-status.correct {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
}

.question-status.wrong {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger-color);
}

.question-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.question-option {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.option-label-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.option-text-small {
    flex: 1;
    line-height: 1.4;
}

.question-option.user-selected {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.question-option.correct-option {
    border-color: var(--success-color);
    background: rgba(72, 187, 120, 0.05);
}

.question-option.user-selected.wrong-option {
    border-color: var(--danger-color);
    background: rgba(245, 101, 101, 0.05);
}

.answer-info {
    display: flex;
    gap: 16px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 12px;
}

.answer-item {
    display: flex;
    gap: 4px;
}

.answer-label {
    color: var(--text-secondary);
}

.answer-value {
    font-weight: 600;
}

.question-explanation {
    padding: 12px;
    background: rgba(102, 126, 234, 0.05);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
}

.explanation-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.explanation-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* 选项和题目中的图片 */
.question-text img,
.option-text-small img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-top: 8px;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .user-card {
        padding: 24px 20px 20px;
        margin-bottom: 20px;
    }
    
    .stats-grid {
        gap: 6px;
    }
    
    .stat-card {
        padding: 12px 6px;
    }
    
    .stat-icon {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .section-title {
        font-size: 16px;
    }
}

@media (max-width: 375px) {
    .user-avatar {
        width: 70px;
        height: 70px;
        font-size: 32px;
    }
    
    .user-name {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 14px;
    }
    
    .stat-icon {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    .container {
        padding: 0 12px;
    }
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .container {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .user-card {
        border-radius: 0 0 32px 32px;
    }
}

/* ========== 新增功能样式 ========== */

/* 等级信息 */
.user-level {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.exp-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.exp-fill {
    height: 100%;
    background: white;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.exp-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* 成就预览 */
.achievements-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-preview-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.achievement-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 32px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.achievement-rarity {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
    text-transform: uppercase;
}

.achievement-rarity.common {
    background: #e0e0e0;
    color: #666;
}

.achievement-rarity.rare {
    background: #2196f3;
    color: white;
}

.achievement-rarity.epic {
    background: #9c27b0;
    color: white;
}

.achievement-rarity.legendary {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
}

.achievement-count {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 8px;
}

/* 空成就状态 */
.empty-achievements {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
    border: 2px dashed rgba(102, 126, 234, 0.3);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    line-height: 1.5;
}

.achievement-hints {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hint-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.hint-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.hint-text {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    text-align: left;
}

/* 学习目标 */
.goals-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.goal-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #e0e0e0;
    transition: all 0.3s;
}

.goal-item[data-goal-type="daily"] {
    border-left-color: #4caf50;
}

.goal-item[data-goal-type="weekly"] {
    border-left-color: #2196f3;
}

.goal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.goal-icon {
    font-size: 20px;
}

.goal-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.goal-status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.goal-status[data-status="not-set"] {
    background: #f5f5f5;
    color: #999;
}

.goal-status[data-status="in-progress"] {
    background: #e3f2fd;
    color: #1976d2;
}

.goal-status[data-status="completed"] {
    background: #e8f5e9;
    color: #388e3c;
}

.goal-detail {
    margin-bottom: 12px;
}

.goal-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.goal-progress-section {
    margin-top: 12px;
}

.goal-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.goal-progress-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.goal-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 成就详情模态框 */
.achievements-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievements-list h4 {
    font-size: 16px;
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.achievement-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #ddd;
}

.achievement-item.unlocked {
    border-left-color: #4caf50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
}

.achievement-item.locked {
    border-left-color: #9e9e9e;
    opacity: 0.7;
}

.achievement-content {
    flex: 1;
}

.achievement-content h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.achievement-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.achievement-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.achievement-date {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 目标设置模态框 */
#goalSettingsModal .modal {
    padding: 20px;
    max-height: 85vh;
    overflow-y: auto;
}

#goalSettingsModal .modal-title {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
}

.goal-description {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.goal-desc-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

#goalSettingsModal .form-group {
    margin-bottom: 20px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}

.goal-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #fff8e1;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #ffe082;
}

.tip-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.tip-text {
    font-size: 12px;
    color: #f57c00;
    line-height: 1.5;
    flex: 1;
}

#goalSettingsModal .form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#goalSettingsModal .form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s ease;
}

#goalSettingsModal .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

#goalSettingsModal .modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

#goalSettingsModal .btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

/* 模态框容器 */
#editModal,
#detailModal,
#achievementsModal,
#goalSettingsModal,
#preferencesModal,
#dataExportModal,
#aboutModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

/* 当模态框显示时 */
#editModal[style*="flex"],
#detailModal[style*="flex"],
#achievementsModal[style*="flex"],
#goalSettingsModal[style*="flex"],
#preferencesModal[style*="flex"],
#dataExportModal[style*="flex"],
#aboutModal[style*="flex"] {
    display: flex !important;
}

/* 模态框遮罩 - 保持向后兼容 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh; /* 确保在移动端正确显示 */
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999; /* 提高层级确保在最顶层 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden; /* 防止页面滚动影响 */
}

/* 防止背景滚动 */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* 模态框内容 - 覆盖 common.css 中的样式 */
.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90vw;
    max-height: 85vh;
    width: 100%;
    max-width: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative !important;
    margin: auto;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    z-index: 10000;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* 关闭按钮 */
.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* 模态框按钮 */
.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 模态框响应式调整 */
@media (max-width: 480px) {
    .overlay {
        padding: 16px;
    }
    
    .modal {
        max-width: 95vw;
        max-height: 90vh;
        padding: 20px;
    }
    
    .modal-title {
        font-size: 16px;
    }
}

@media (max-width: 375px) {
    .achievement-preview-item {
        padding: 10px;
    }

    .achievement-name {
        font-size: 13px;
    }

    .goal-item {
        padding: 14px;
    }

    .overlay {
        padding: 12px;
    }

    .modal {
        padding: 16px;
        max-width: 98vw;
        max-height: 92vh;
    }

    .modal-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .modal-buttons .btn {
        width: 100%;
    }
    
    .modal-title {
        font-size: 15px;
        margin-bottom: 12px;
    }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .modal {
        max-height: 95vh;
        padding: 16px;
    }
    
    .overlay {
        padding: 10px;
    }
}

/* 设置列表样式 */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.setting-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.setting-item:active {
    background: #f8f9fa;
}

.setting-icon {
    font-size: 20px;
    margin-right: 12px;
    width: 32px;
    text-align: center;
}

.setting-content {
    flex: 1;
}

.setting-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.setting-arrow {
    font-size: 18px;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* 开关样式 */
.switch-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.switch-label {
    font-size: 14px;
    color: var(--text-primary);
}

/* 导出选项样式 */
.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.export-icon {
    font-size: 24px;
    margin-right: 12px;
    width: 40px;
    text-align: center;
}

.export-content {
    flex: 1;
}

.export-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.export-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* 关于应用样式 */
.about-content {
    text-align: left;
}

.app-info {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.app-icon {
    font-size: 48px;
    margin-right: 16px;
}

.app-details h4 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.version {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.description {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.features-list h5,
.contact-info h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.features-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.contact-info {
    margin-top: 20px;
}

.contact-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 改进的空状态样式 */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* 改进的加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.8);
}

.loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

/* 退出登录区域 */
.logout-section {
    margin-top: 32px;
    margin-bottom: 32px;
    padding: 0 4px;
}

.logout-section .btn {
    font-weight: 600;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
    transition: all 0.3s ease;
}

.logout-section .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 101, 101, 0.4);
}

/* 字体加载优化 */
@font-face {
    font-family: 'KaTeX_Main';
    src: url('https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/fonts/KaTeX_Main-Regular.woff2') format('woff2');
    font-display: swap; /* 使用系统字体作为备用，直到自定义字体加载完成 */
}

@font-face {
    font-family: 'KaTeX_Math';
    src: url('https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/fonts/KaTeX_Math-Italic.woff2') format('woff2');
    font-display: swap;
}

/* KaTeX 数学公式容器优化 */
.katex {
    font-display: swap;
}

.katex-display {
    font-display: swap;
}

/* 安全区域适配 */
@supports (padding: max(0px)) {
    .user-card {
        padding-top: max(30px, calc(env(safe-area-inset-top) + 30px));
    }
    
    .logout-section {
        margin-bottom: max(32px, calc(env(safe-area-inset-bottom) + 32px));
    }
    
    .overlay {
        padding-top: max(20px, calc(env(safe-area-inset-top) + 20px));
        padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* iOS Safari 视口修复 */
@supports (-webkit-touch-callout: none) {
    .overlay {
        height: -webkit-fill-available;
        min-height: 100vh;
    }
}

/* ========== 选项卡样式 ========== */
.tabs-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 0;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tabs-nav {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.tabs-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.tab-btn {
    flex: 1;
    min-width: 80px;
    padding: 14px 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

.tab-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-bottom-color: white;
}

.tabs-content {
    padding: 20px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 选项卡内容样式优化 */
.tab-pane .section-desc {
    color: white;
    margin-bottom: 16px;
    padding: 0;
    opacity: 0.9;
}

/* 响应式优化 */
@media (max-width: 480px) {
    .tab-btn {
        padding: 12px 10px;
        font-size: 12px;
        min-width: 70px;
    }
    
    .tabs-content {
        padding: 16px;
    }
}

@media (max-width: 375px) {
    .tab-btn {
        padding: 10px 8px;
        font-size: 11px;
        min-width: 65px;
    }
    
    .tabs-content {
        padding: 12px;
    }
}

